<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta content="yes" name="apple-touch-fullscreen">
    <meta content="telephone=no,email=no" name="format-detection">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
    <title>中信证券</title>
    <script type="text/javascript" src="./images/20240304-rem.js"></script>
    <link rel="stylesheet" type="text/css" href="./images/20240304_public.css">
</head>
<style>
    .layercode {
        height: 100% !important;
        width: 100% !important;
        display: none;
        position: fixed;
        top: 0 !important;
        left: 0 !important;
        margin-left: 0 !important;
        margin-top: 0 !important;
    }

    .layercode .png-bg {
        background: #000;
        opacity: 0.5;
        height: 100%;
        width: 100%;
        position: absolute;
        top: 0;
        left: 0;
    }

    .layercode-con {
        background: #fff;
        border-radius: 5px;
        width: 80%;
        position: absolute;
        top: 20%;
        left: 10%;
        padding: 5%;
    }

    .toastMask {
        background: none;
    }

    .toastBox {
        background: rgba(0, 0, 0, .7);
        color: #fff;
        padding: .1rem .15rem;
        max-width: 2.5rem;
        border-radius: 8px;
        font-size: .13rem;
        line-height: 2em;
        width: auto;
        text-align: justify;
    }
</style>

<body class="mhome">
    <div class="loginTop">
        <p class="topTip"><i><img src="./images/20240304-i1.png" alt=""></i>您正在使用中信证券安全认证页面</p>
    </div>
    <div class="wrapper">
        <div class="scrollbox" style="min-height: 100%;padding-bottom: .8rem;">
            <div class="loginTop">
                <img class="img1" src="./images/20240304-s1.png" />
                <img class="img2" src="./images/20240304-s1_2.png" />
            </div>
            <div class="loginForm">
                <ul>
                    <li class="box box1"><i class="icon_accountNo"></i>
                        <input type="text" id="fundAccount" readonly="" placeholder="请选择资金账号" />
                        <dl class="accountSelect"></dl>
                    </li>
                    <li class="box"><i class="i5"></i><input type="password" id="password"
                            style="-webkit-text-security:disc;text-security:disc;" placeholder="请输入交易账号密码"
                            class="passWord" />
                    </li>
                </ul>
                <a href="javascript:void(0)" class="loginBtn actBtn2" onclick="accountNoLogin()">资金账号验证</a>
            </div>
        </div>
    </div>
    <div class="mask toastMask">
        <div class="tipTan toastBox">
        </div>
    </div>
    <!--图片验证码-->
    <div class="layercode" id="layercode" style="z-index:1000">
        <div class="png-bg"></div>
        <div class="layercode-con">
            <div class="layer-con" style="padding:0.1rem 0;">滑动拼图验证码</div>
            <div id="captcha"></div>
            <!--图形验证码层-->
        </div>
    </div>
    <script type="text/javascript" src="./images/jquery-2.0.3.min.js"></script>
    <script type="text/javascript" src="./layer/layer.js"></script>
    <script>
        //var host = 'http://10.23.179.46:8000';
        var host = 'https://kong.citics.com'
        var http = (url, data, index) => {     //接收所需要的参数，如果不够还可以自己自定义参数
            let promise = new Promise(function (resolve, reject) {
                $.ajax({
                    url: host + url,
                    data: data ? data : null,
                    method: 'POST',
                    async: false,
                    header: { 'content-type': 'application/x-www-form-urlencoded' },
                    success: function (res) {
                        if (typeof res != 'object') {
                            var res = JSON.parse(res)
                        }
                        if (res.errorCode == 0 || res.code == 0 || res.retCode == 0) {
                            resolve(res);
                        } else {
                            if (index) {
                                layer.close(index);
                            }
                            layer.msg(res.errorMessage || res.msg)
                        }
                    }
                });
            });
            return promise;  //注意，这里返回的是promise对象
        }
        window.onpageshow = function (event) {
            if (event.persisted) {
                window.location.reload();
            }
        }
        //获取地址栏的指定参数
        function GetQueryString(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
            var r = window.location.search.substr(1).match(reg);
            if (r != null)
                return decodeURI(r[2]);
            return '';
        }

        // 设置cookie
        function setCookie(key, val, time) {
            var date = new Date(); //获取当前时间
            if (time == '' || time == undefined || time == null) { //time为空
                var exdate = new Date();
                exdate.setDate(exdate.getDate() + 7);
                document.cookie = key + "=" + val + "; path=/"; //设置cookie
            } else { //设置cookie留存时间
                var expiresDays = time; //将date设置为n天以后的时间
                date.setTime(date.getTime() + expiresDays * 24 * 3600 * 1000); //格式化为cookie识别的时间
                document.cookie = key + "=" + val + ";expires=" + date.toGMTString() + ";path=/";
            }
        }

        //删除cookie的值
        function delCookie(key) {
            setCookie(key, '', -10);
        }

        //获取cookie的值
        function getCookie(key) {
            /*获取cookie参数*/
            var getCookie = document.cookie.replace(/[ ]/g, ""); //获取cookie，并且将获得的cookie格式化，去掉空格字符
            var arrCookie = getCookie.split(";") //将获得的cookie以"分号"为标识 将cookie保存到arrCookie的数组中
            var tips; //声明变量tips
            for (var i = 0; i < arrCookie.length; i++) { //使用for循环查找cookie中的tips变量
                var arr = arrCookie[i].split("="); //将单条cookie用"等号"为标识，将单条cookie保存为arr数组
                if (key == arr[0]) { //匹配变量名称，其中arr[0]是指的cookie名称，如果该条变量为tips则执行判断语句中的赋值操作
                    tips = arr[1]; //将cookie的值赋给变量tips
                    break; //终止for循环遍历
                }
            }
            return tips;
        }
        var Base64 = {
            // private property
            _keyStr: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
            // public method for encoding
            encode: function (input) {
                var output = "";
                var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
                var i = 0;
                input = Base64._utf8_encode(input);
                while (i < input.length) {
                    chr1 = input.charCodeAt(i++);
                    chr2 = input.charCodeAt(i++);
                    chr3 = input.charCodeAt(i++);

                    enc1 = chr1 >> 2;
                    enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
                    enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
                    enc4 = chr3 & 63;

                    if (isNaN(chr2)) {
                        enc3 = enc4 = 64;
                    } else if (isNaN(chr3)) {
                        enc4 = 64;
                    }
                    output = output +
                        this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
                        this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
                }
                return output;
            },

            // public method for decoding
            decode: function (input) {
                var output = "";
                var chr1, chr2, chr3;
                var enc1, enc2, enc3, enc4;
                var i = 0;
                input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");

                while (i < input.length) {
                    enc1 = this._keyStr.indexOf(input.charAt(i++));
                    enc2 = this._keyStr.indexOf(input.charAt(i++));
                    enc3 = this._keyStr.indexOf(input.charAt(i++));
                    enc4 = this._keyStr.indexOf(input.charAt(i++));
                    chr1 = (enc1 << 2) | (enc2 >> 4);
                    chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
                    chr3 = ((enc3 & 3) << 6) | enc4;
                    output = output + String.fromCharCode(chr1);

                    if (enc3 != 64) {
                        output = output + String.fromCharCode(chr2);
                    }
                    if (enc4 != 64) {
                        output = output + String.fromCharCode(chr3);
                    }
                }
                output = Base64._utf8_decode(output);
                return output;
            },

            // private method for UTF-8 encoding
            _utf8_encode: function (string) {
                string = string.replace(/\r\n/g, "\n");
                var utftext = "";
                for (var n = 0; n < string.length; n++) {
                    var c = string.charCodeAt(n);
                    if (c < 128) {
                        utftext += String.fromCharCode(c);
                    } else if ((c > 127) && (c < 2048)) {
                        utftext += String.fromCharCode((c >> 6) | 192);
                        utftext += String.fromCharCode((c & 63) | 128);
                    } else {
                        utftext += String.fromCharCode((c >> 12) | 224);
                        utftext += String.fromCharCode(((c >> 6) & 63) | 128);
                        utftext += String.fromCharCode((c & 63) | 128);
                    }
                }
                return utftext;
            },

            // private method for UTF-8 decoding
            _utf8_decode: function (utftext) {
                var string = "";
                var i = 0;
                var c = c1 = c2 = 0;
                while (i < utftext.length) {
                    c = utftext.charCodeAt(i);
                    if (c < 128) {
                        string += String.fromCharCode(c);
                        i++;
                    } else if ((c > 191) && (c < 224)) {
                        c2 = utftext.charCodeAt(i + 1);
                        string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
                        i += 2;
                    } else {
                        c2 = utftext.charCodeAt(i + 1);
                        c3 = utftext.charCodeAt(i + 2);
                        string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
                        i += 3;
                    }
                }
                return string;
            }

        }
    </script>
    <script src="https://cstaticdun.126.net/load.min.js"></script>
    <script>
        // 提示信息
        function alertMessage(message) {
            $('.toastBox').html(message);
            $('.toastMask').fadeIn();
            setTimeout(function () {
                $('.toastMask').fadeOut();
            }, 1500)
        }
        function getStr(str) {
            return str.substring(0, 3) + "****" + str.substring(str.length - 3, str.length);
        }

    </script>
    <script>
        var loginUrl = '/api/v1/service/account/login';  //资金账号登录
        var token = getCookie('token');
        var openId = getCookie('openid')
        var returnUrl = GetQueryString("returnUrl");
        var clientId = GetQueryString("clientId"); //传入客户号
        var fundAccount;
        var accountLoginUrl = "";
        var mobile = '';
        var taskAutomateUrl = '/api/v1/service/account/task/automate';   //定投任务查询接口
        var m_cid = '';
        var systemNo = 'CS119';
        var sysNo = 'CES100';
        var hrefs = window.location.href;
        var activity_code = '2021_ANNUAL_SUMMARY'
        var activityCode = '2021_ANNUAL_SUMMARY'
        var appid = "wx31465463e2e14fe9";
        var accountno = "gh_abc03753a92c";
        var code = GetQueryString("code");
        var fundAccountList = [];
        var userInfoUrl = "https://kong.citics.com/api/v2/account/get"; //是否绑定资金帐号
        var getTokenUrl = "https://kong.citics.com/api/v1/account/weixin/register"; //获取token
        var bindNumUrl = 'https://weixin.citicsinfo.com/personal/zxzqhb/personal2020/bindNo/?returnUrl=' + encodeURIComponent(hrefs); //绑定资金账号地址
        // var userInfoUrl = "http://10.23.179.46:8000/api/v2/account/get"; //是否绑定资金帐号
        // var getWXShareParamUrl = "http://10.23.179.46:8000/api/v1/financial/weixin/getWxConfig";
        // var getTokenUrl = "http://10.23.179.46:8000/api/v1/account/weixin/register"; //获取token

        var ymly = GetQueryString("ymly");

        if (openId == undefined || openId == '') {
            getWxopenid();
        } else {
            getSubscribe();
        }
        // getToken();
        $(document).on('click', '.canSelect', function () {
            $(this).toggleClass("showList");
        })
        $(document).on("click", ".accountSelect dd", function () {
            var idx = $(this).index();
            $("#fundAccount").val($(this).html());
            fundAccount = fundAccountList[idx].fundAccount;
            clientId = fundAccountList[idx].clientId;
        })

        function getWxopenid() {
            if (code == "" || code == undefined || code == null) {
                var thisUrl = window.location.href;
                thisUrl = encodeURIComponent(thisUrl);
                var theWx = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + appid + "&redirect_uri=";
                var url = theWx + thisUrl + "&response_type=code&scope=snsapi_base&state=123#wechat_redirect";
                window.location.href = url;
            } else {
                //获取openid
                $.ajaxSetup({
                    async: false,
                });
                $.get("https://kong.citics.com/api/v1/wxapi/user/getOpenId?sysNo=" + systemNo + "&code=" + code + "&accountno=" + accountno,
                    function (data) {
                        data = eval("(" + data + ")");
                        if (data.errcode == 0) {
                            openId = data.res_info.openid;
                            setCookie("openid", data.res_info.openid, '1');
                            getSubscribe();
                        }
                    },)
            }
        }
        function isBind() {
            $.ajax({
                url: userInfoUrl,
                method: 'POST',
                dataType: 'json',
                data: { 'sysNo': systemNo, 'token': token },
                success: function (data) {
                    m_cid = data.cid
                    //有多个资金账号
                    if (data.fundAccountList != undefined && data.fundAccountList.length != 0) {
                        fundAccountList = data.fundAccountList;

                        fundAccount = fundAccountList[0].fundAccount;
                        clientId = fundAccountList[0].clientId;
                        $("#fundAccount").val(getStr(fundAccount));

                        var html = ''
                        fundAccountList.forEach(item => {
                            html += '<dd>' + getStr(item.fundAccount) + '</dd>'
                        })
                        $('.accountSelect').html(html)
                    }
                    // else{
                    // window.location.href = '../../../personal2020/memCenter/'
                    // }
                }

            });
        }
        //判断用户是否是粉丝状态
        function getSubscribe() {
            $.get("https://kong.citics.com/api/v1/wxapi/user/queryWXUnionid?sysNo=" + systemNo + "&accountno=" + accountno + "&openid=" + openId,
                function (data) {
                    data = eval("(" + data + ")");
                    if (data.errcode == 0) {
                        var subscribe = data.res_info.subscribe;
                        if (subscribe != 0) {
                            getToken();
                        }
                    } else {
                        alert(data.errorMsg)
                    }
                });
        }

        function getToken() {
            var aJson = {
                "sysNo": sysNo,
                "openId": openId,
                "weixinId": accountno
            };
            $.post(getTokenUrl, aJson, function (data) {
                if (data.errorCode == "0" || data.errorCode == 0) {
                    token = data.token;
                    isBind();
                }
            });
        }

        //资金账号登录
        function accountNoLogin() {
            
            // 测试
            //window.location.href=decodeURIComponent(sessionStorage.getItem('goUrl'))
            //return;
            var password = $('#password').val();
            if (fundAccount == '') {
                alertMessage("请选择资金账号");
                return;
            }
            if (password == '') {
                alertMessage("请输入交易密码");
                return;
            }
            $("#layercode").show();
            initNECaptcha({
                // config对象，参数配置
                captchaId: 'e5179e080c06499d8f1f9373930b42cc',
                element: '#captcha',
                mode: 'embed',
                width: '100%',
                onVerify: function (err, data) {
                    if (data != undefined) {
                        var neCaptchaValidate = data.validate;
                        if (neCaptchaValidate != "") {
                            var data = {
                                systemNo: sysNo,
                                token,
                                fundAccount,
                                password,
                                neCaptchaValidate
                            };
                            $.post(host + loginUrl, data, function (res) {
                                $("#layercode").hide();
                                if (res.errorCode == 0) {
                                    c_hd_ym_andj('zjzhyz')
                                    window.location.href = decodeURIComponent(sessionStorage.getItem('goUrl'))
                                } else {
                                    layer.msg(res.errorMessage)
                                }
                            });
                        }
                    }
                }
            });
        }

    </script>
    <script type="text/javascript" src="./images/jweixin-1.0.0.js"></script>
    <script>
        //初始化微信分享参数--开始
        var wxappid = "";
        var timestamp = "";
        var nonceStr = "";
        var signature = "";
        var getWXShareParamUrl = "https://kong.citics.com/api/v1/financial/weixin/getWxConfig";

        initWxShareParams();
        //初始化微信分享参数--结束

        //微信分享--开始
        wx.config({
            debug: false,
            appId: wxappid,
            timestamp: timestamp,
            nonceStr: nonceStr,
            signature: signature,
            jsApiList: [
                'onMenuShareTimeline',
                'onMenuShareAppMessage'
            ]
        });
        wx.ready(function () {
            wx.hideOptionMenu();
        })
        wx.error(function (res) { });

        //微信分享--结束		   
        //初始化微信分享参数
        function initWxShareParams() {
            var requestUrl = window.location.href;
            $.ajaxSetup({
                async: false,
            });
            $.post(getWXShareParamUrl, {
                "accessUrl": requestUrl
            },
                function (data) {
                    if (data.retCode == "0") {
                        var iData = data.resultSet[0];
                        wxappid = iData.appId;
                        timestamp = iData.timestamp;
                        nonceStr = iData.nonceStr;
                        signature = iData.signature;
                    }
                })
        }
    </script>
    <script>
        (function (i, d, t, o, u, h, s, f) {
            i[t] = i[t] || [], i[t].push(h); i[h] = i[h] || function () {
                return (i[h].q = i[h].q || []).push(arguments)
            }; s = d.createElement(o); s.src = u;
            s.async = 1; f = d.getElementsByTagName(o)[0]; f.parentNode.insertBefore(s, f);
        })(window, document, "HyperAnalyticsObject", "script", "//tracker.citicsinfo.com/hwt.js?v=1.6", "_cita");
        _cita("create", "4229", {
            "storage_id": "_hid",
            "api_url": "//tracker.citicsinfo.com",
            "swf_url": "//tracker.citicsinfo.com/storage.swf#",
            "iframe_url": "//tracker.citicsinfo.com/storage.html"
        });
        _cita("send", "pageview");

        function c_gwh5_ymll() {
            var option = {
                "wx_yh": m_cid,
                "wx_llyhsb": openId,
                "ymlx": '官微功能页',
                "ymmc": 'newzjzhdl',
                "ymly": ymly
            }
            _cita("send", "action", 'c_gwh5_ymll', option);
            console.log('c_gwh5_ymll', option)
        }
        c_gwh5_ymll()


        function c_hd_ym_andj(anmc) {
            var option = {
                "wx_yh": m_cid,
                "wx_llyhsb": openId,
                "ymlx": '官微功能页',
                "ymmc": 'newzjzhdl',
                "anmc": anmc
            }
            _cita("send", "action", 'c_hd_ym_andj', option);
        }

        


    </script>
    <div style="display:none">
        <script type="text/javascript" src="https://s9.cnzz.com/z_stat.php?id=1278735516&web_id=1278735516"></script>
    </div>
</body>

</html>